<?php

namespace App\Console\Commands\Clear;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
use function dd;

class Statistics extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'cache:flush-tag {tagName?}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '清除cache:tag缓存';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $tag = $this->argument("tagName");
        if ($tag){
            Cache::store('redis')->tags($tag)->flush();
        }
    }
}
